﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using ThanhTu.GNC.Media.KQXS.DataAccess.BL;
using ThanhTu.GNC.Media.KQXS.Common;
using System.Data;

namespace GNCMedia.KQXS.MenuPage
{
    public partial class ReportDoubleZeroToDoubleNine : System.Web.UI.UserControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            ProvinceBL vProvinceBL = new ProvinceBL();
            ResultLotteryBL vResultLotteryBL = new ResultLotteryBL();
            try
            {
                if (!Page.IsPostBack)
                {
                    string thang = string.Empty;
                    ddl_province.DataSource = vProvinceBL.selectadd();
                    ddl_province.DataTextField = "princeName";
                    ddl_province.DataValueField = "provinceID";
                    ddl_province.DataBind();

                    if (Convert.ToInt32(DateTime.Now.Month.ToString()) < 10)
                    {
                        thang = "0" + DateTime.Now.Month.ToString();
                    }
                    else
                    {
                        thang = DateTime.Now.Month.ToString();
                    }
                    ddl_denngay.SelectedValue = DateTime.Now.Day.ToString();
                    ddl_denthang.SelectedValue = thang;
                    ddl_dennam.SelectedValue = DateTime.Now.Year.ToString();
                    ddl_tunam.SelectedValue = DateTime.Now.Year.ToString();

                    string sto_date = ddl_tungay.SelectedValue + "/" + ddl_tuthang.SelectedValue + "/" + ddl_tunam.SelectedValue;
                    string sfrom_date = ddl_denngay.SelectedValue + "/" + ddl_denthang.SelectedValue + "/" + ddl_dennam.SelectedValue;
                    DateTime to_date = Utils.ToDateTime(sto_date);
                    DateTime from_date = Utils.ToDateTime(sfrom_date);
                    //int count = 0;

                    //rpt_Statistic_0_To_99.DataSource = vResultLotteryBL.Statistic_0_99(ddl_province.SelectedValue, to_date, from_date, 1, 1000, ref count);
                    //rpt_Statistic_0_To_99.DataBind();

                    iframe_00_99.Attributes["src"] = "00from99.aspx?ID=" + ddl_province.SelectedValue + "&to=" + sto_date + "&from=" + sfrom_date;
                   // aiframe_00_99.Attributes["href"] = "00from99.aspx?ID=" + ddl_province.SelectedValue + "&to=" + sto_date + "&from=" + sfrom_date;
                    aiframe_00_991.Attributes["href"] = "00from99.aspx?ID=" + ddl_province.SelectedValue + "&to=" + sto_date + "&from=" + sfrom_date;
                    lbl_nameprovince.Text = ddl_province.SelectedItem.Text;
                    lbl_todate1.Text = sto_date;
                    lbl_fromdate2.Text = sfrom_date;
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }

        protected void Itbl_xem_Click(object sender, ImageClickEventArgs e)
        {
            ResultLotteryBL vResultLotteryBL = new ResultLotteryBL();
            try
            {
                string sto_date = ddl_tungay.SelectedValue + "/" + ddl_tuthang.SelectedValue + "/" + ddl_tunam.SelectedValue;
                string sfrom_date = ddl_denngay.SelectedValue + "/" + ddl_denthang.SelectedValue + "/" + ddl_dennam.SelectedValue;
                DateTime to_date = Utils.ToDateTime(sto_date);
                DateTime from_date = Utils.ToDateTime(sfrom_date);
                //int count = 0;
                //rpt_Statistic_0_To_99.DataSource = vResultLotteryBL.Statistic_0_99(ddl_province.SelectedValue, to_date, from_date, 1, 1000, ref count);
                //rpt_Statistic_0_To_99.DataBind();
                iframe_00_99.Attributes["src"] = "00from99.aspx?ID=" + ddl_province.SelectedValue + "&to=" + sto_date + "&from=" + sfrom_date;
                //aiframe_00_99.Attributes["href"] = "00from99.aspx?ID=" + ddl_province.SelectedValue + "&to=" + sto_date + "&from=" + sfrom_date;
                aiframe_00_991.Attributes["href"] = "00from99.aspx?ID=" + ddl_province.SelectedValue + "&to=" + sto_date + "&from=" + sfrom_date;
                lbl_nameprovince.Text = ddl_province.SelectedItem.Text;
                lbl_todate1.Text = sto_date;
                lbl_fromdate2.Text = sfrom_date;

            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
    }
}